import java.security.MessageDigest;
import java.util.*;
/*
 * A child class of 'Member'
 * Contains data directly relating to the patient
 */
public class Patient extends Member{
	private ArrayList patientData;
	
	//constructor
	public Patient(String f, String l, MessageDigest p, String u, String a, int id) {
		super(f, l, p, u, a, id);
                patientData = new ArrayList();
               
		 	//NULL if patient data not known upon creation

	}
        
        public void addUpdate(String b, String p, String w, String d, String m, String y)
        {
            patientData.add(new Data(b,p,w,d,m,y));
        }
              
        public int getSize()
        {
            return patientData.size();
        }
        
        public String sToStringAt(int index)
        {
            String temp = " ";
            temp += ((Data)patientData.get(index)).getSugar();
            temp += " mmol/L :: ";
            temp += ((Data)patientData.get(index)).getMonth();
            temp += "/";
            temp += ((Data)patientData.get(index)).getDay();
            temp += "/";
            temp += ((Data)patientData.get(index)).getYear();
            temp += " ";
      
            
            return temp;
        }
        
        public String pToStringAt(int index)
        {
            String temp = " ";
            temp += ((Data)patientData.get(index)).getPressure();
            temp += " mmHg :: ";
            temp += ((Data)patientData.get(index)).getMonth();
            temp += "/";
            temp += ((Data)patientData.get(index)).getDay();
            temp += "/";
            temp += ((Data)patientData.get(index)).getYear();
            temp += " ";

            
            return temp;
        }
        
        public String wToStringAt(int index)
        {
            String temp = " ";
             temp += ((Data)patientData.get(index)).getWeight();
             temp += " Kg :: ";
            temp += ((Data)patientData.get(index)).getMonth();
            temp += "/";
            temp += ((Data)patientData.get(index)).getDay();
            temp += "/";
            temp += ((Data)patientData.get(index)).getYear();
            temp += " ";
            
           
            return temp;
        }
        
        
       public class Data
       {    
            private double sugar;
            private double pressure;
            private double weight;
            private int day;
            private int month;
            private int year;
            
           
           public Data(String s, String p, String w, String d, String m, String y)
           {
               
               try
               {
                 sugar = Double.parseDouble(s);
                 pressure = Double.parseDouble(p);
                 weight = Double.parseDouble(w); 
                 day = Integer.parseInt(d);
                 month = Integer.parseInt(m);
                 year = Integer.parseInt(y);
               }
               catch(Exception ex)
               {
               }
           }
           
           public int getYear()
           {
               return year;
           }
           
           public int getMonth()     
           {
                return month;
           }
           
           public int getDay()
           {
               return day;
           }
           
           public double getSugar()
           {
               return sugar;
           }
           
           public double getPressure()
           {
               return pressure;
           }
           
           public double getWeight()
           {
               return weight;
           }
       
       }
	
        /*
	public void updatePatientData(PatientData p) {		//for if patient data has changed, or to initially add it from being NULL
		patientData = p;
	}
	*/
}
